package com.javalsj.common.webflux.context;

import org.springframework.http.server.reactive.ServerHttpRequest;

import reactor.core.publisher.Mono;

/**
 * @description 存储WEBFLUX上下文
 * @author WANGJIHONG
 * @date 2019年6月3日 上午9:17:31
 * @Copyright 版权所有 (c) www.javalsj.com
 * @memo 无备注说明
 */
public class CommonWebFluxRequestContextHolder {

	public static final String CONTEXT_KEY = "ServerHttpRequestContext";

	public static Mono<ServerHttpRequest> getRequest() {
		return Mono.subscriberContext().map(ctx -> ctx.get(CONTEXT_KEY));
	}

}
